﻿namespace Acl.Modular
{
    internal class Module : IModule
    {
        internal Module(IModuleDescriptor descriptor, uint id) : this(id, descriptor.Name, descriptor.Author, descriptor.StartLevel, descriptor.Version)
        {
        }

        internal Module(uint id, string name, string author, uint startLevel, string version)
        {
            State = ModuleState.Installed;
            Id = id;
            Name = name;
            Author = author;
            StartLevel = startLevel;
            Version = version;
        }

        public uint Id { get; }

        public bool IsSystemModule => Id == 0;

        public string Name { get; }

        public string Author { get; }

        public uint StartLevel { get; }

        public string Version { get; }

        public ModuleState State { get; internal set; }

        public override string ToString() => $"{{Name:{Name},StartLevel:{StartLevel},Author:{Author},Version:{Version} }}";
    }
}